From 233f42192371a1e15f04a86bb9f62a6e742bbcd7 Mon Sep 17 00:00:00 2001 From: Ryan Lane Date: Wed, 13 Jun 2012 18:34:32 +0200 Subject: [PATCH] Allowing the change password form to be extended Change-Id: Id676b1ec4b43140790b18a87bc8466f10c957577 --- RELEASE-NOTES-1.20 | 1 + docs/hooks.txt | 4 ++++ includes/specials/SpecialChangePassword.php | 16 ++++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index fefb6864d1..5018f9d799 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -70,6 +70,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. * (bug 35705) QUnit upgraded from 1.2.0 to 1.7.0 * cleanupSpam.php now can delete spam pages if --delete was specified instead of blanking them. +* Added new hook ChangePasswordForm to allow adding of additional fields in Special:ChangePassword === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. diff --git a/docs/hooks.txt b/docs/hooks.txt index a57d1d2aee..c1fd5fac99 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -677,6 +677,10 @@ $output: OutputPage object in use 'CategoryPageView': before viewing a categorypage in CategoryPage::view $catpage: CategoryPage instance +'ChangePasswordForm': For extensions that need to add a field to the ChangePassword form +via the Preferences form +&$extraFields: An array of arrays that hold fields like would be passed to the pretty function. + 'ChangesListInsertArticleLink': Override or augment link to article in RC list. &$changesList: ChangesList instance. &$articlelink: HTML of link to article (already filled-in). diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index f6482ef5b4..2b88325803 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -136,6 +136,15 @@ class SpecialChangePassword extends UnlistedSpecialPage { $oldpassMsg = 'oldpassword'; $submitMsg = 'resetpass-submit-loggedin'; } + $extraFields = array(); + wfRunHooks( 'ChangePasswordForm', array( &$extraFields ) ); + $prettyFields = array( + array( 'wpName', 'username', 'text', $this->mUserName ), + array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ), + array( 'wpNewPassword', 'newpassword', 'password', null ), + array( 'wpRetype', 'retypenew', 'password', null ), + ); + $prettyFields = array_merge( $prettyFields, $extraFields ); $this->getOutput()->addHTML( Xml::fieldset( $this->msg( 'resetpass_header' )->text() ) . Xml::openElement( 'form', @@ -149,12 +158,7 @@ class SpecialChangePassword extends UnlistedSpecialPage { Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" . $this->msg( 'resetpass_text' )->parseAsBlock() . "\n" . Xml::openElement( 'table', array( 'id' => 'mw-resetpass-table' ) ) . "\n" . - $this->pretty( array( - array( 'wpName', 'username', 'text', $this->mUserName ), - array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ), - array( 'wpNewPassword', 'newpassword', 'password', null ), - array( 'wpRetype', 'retypenew', 'password', null ), - ) ) . "\n" . + $this->pretty( $prettyFields ) . "\n" . $rememberMe . "\n" . "\n" . -- 2.20.1